/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import entity.Bill_Detail;
import java.sql.Date;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Windows7
 */
public class TableBillDetail extends AbstractTableModel {

    public static ArrayList<Bill_Detail> BillDetail;
    private final String columnName[] = {"Bill_Id", "Menu_Id", "Menu_price", "Amount"};
    private final Class columnClass[] = {Integer.class, Integer.class, Integer.class, Integer.class};

    public TableBillDetail(ArrayList<Bill_Detail> Bill_Detail) {
        this.BillDetail = Bill_Detail;
    }

    public TableBillDetail() {
        BillDetail = new ArrayList<Bill_Detail>();
    }

    @Override
    public int getRowCount() {
        return this.BillDetail.toArray().length;
    }

    @Override
    public int getColumnCount() {
        return columnName.length;
    }

    @Override
    public String getColumnName(int column) {
        return columnName[column];

    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        switch (columnIndex) {
            case 1:
                return BillDetail.get(rowIndex).getBill_Id();
            case 2:
                return BillDetail.get(rowIndex).getMenu_Id();
            case 3:
                return BillDetail.get(rowIndex).getAmount();
            default:
                return null;
        }
    }
}
